import request from '@/utils/request'

// 查询资产报废列表
export function listScrap(query) {
  return request({
    url: '/assets/scrap/list',
    method: 'get',
    params: query
  })
}

// 查询资产报废详细
export function getScrap(assetId) {
  return request({
    url: '/assets/scrap/' + assetId,
    method: 'get'
  })
}

// 新增资产报废
export function addScrap(data) {
  return request({
    url: '/assets/scrap',
    method: 'post',
    data: data
  })
}

// 修改资产报废
export function updateScrap(data) {
  return request({
    url: '/assets/scrap',
    method: 'put',
    data: data
  })
}

// 删除资产报废
export function delScrap(assetId) {
  return request({
    url: '/assets/scrap/' + assetId,
    method: 'delete'
  })
}

export function requestScrap(assetId, scrapReason) {
  return request({
    url: '/assets/scrap/request',
    method: 'post',
    data: { assetId }, // 保持OliveAssets原有字段
    params: { scrapReason } // 新增参数
  })
}

